package models

type ResourceProperties struct {
	ValueType    string `json:"valueType" yaml:"valueType" validate:"required,edgex-dto-value-type"`
	ReadWrite    string `json:"readWrite" yaml:"readWrite" validate:"required,oneof='R' 'W' 'RW' 'WR'"`
	Units        string `json:"units" yaml:"units"`
	Minimum      string `json:"minimum" yaml:"minimum"`
	Maximum      string `json:"maximum" yaml:"maximum"`
	DefaultValue string `json:"defaultValue" yaml:"defaultValue"`
	Mask         string `json:"mask" yaml:"mask"`
	Shift        string `json:"shift" yaml:"shift"`
	Scale        string `json:"scale" yaml:"scale"`
	Offset       string `json:"offset" yaml:"offset"`
	Base         string `json:"base" yaml:"base"`
	Assertion    string `json:"assertion" yaml:"assertion"`
	MediaType    string `json:"mediaType" yaml:"mediaType"`
}

type ProductResource struct {
	Description string `json:"description" yaml:"description"`
	Name        string `json:"name" yaml:"name" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
	// 产品属性的标识
	Code       string                 `json:"code,omitempty"`
	IsHidden   bool                   `json:"isHidden" yaml:"isHidden"`
	Tag        string                 `json:"tag" yaml:"tag"`
	Properties ResourceProperties     `json:"properties" yaml:"properties"`
	Attributes map[string]interface{} `json:"attributes" yaml:"attributes"`
}

type ProductAttribute struct {
	// 创建和更新时间
	DBTimestamp
	// id
	Id string `json:"id"`
	// 产品id
	ProductId string `json:"productId"`
	// 产品resource
	Resource ProductResource `json:"productResource"`
}
